package com.carkeeper.caruser.contorller;

import com.carkeeper.caruser.service.EsayService;
import com.carkeeper.entity.Result;
import com.carkeeper.entity.StatusCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/esay")
@Api(value = "导出excel")
@CrossOrigin
public class EsayController {

    @Autowired
    private EsayService esayService;

    /**
     * 导出车主信息表格
     * @return
     */
    @ApiOperation(value = "导出车主信息表格")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentpage",value = "当前页",required = true),
            @ApiImplicitParam(name = "pagesize",value = "每页条数",required = true)
    })
    @GetMapping("/esayExcel")
    @ResponseBody
    public Result esayExcel(@RequestParam("currentpage") Integer currentpage,@RequestParam("pagesize") Integer pagesize) {
        esayService.createEsay(currentpage,pagesize);
        return new Result(true, StatusCode.OK, "成功");
    }
}
